package org.springside.examples.miniweb.service.dictionary;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import org.springside.examples.miniweb.entity.dictionary.Province;
import org.springside.examples.miniweb.dao.dictionary.ProvinceDao;
import org.springside.modules.orm.Page;
import org.springside.modules.orm.PropertyFilter;

@Service
@Transactional
public class ProvinceManager {
	@Autowired
	private ProvinceDao provinceDao;

	// Province Manager //
	@Transactional(readOnly = true)
	public Province getProvince(Long id) {
		return provinceDao.get(id);
	}

	@Transactional(readOnly = true)
	public List<Province> getAllProvince() {
		return provinceDao.getAll();
	}
	
	@Transactional(readOnly = true)
	public Page<Province> searchProvince(final Page<Province> page, final List<PropertyFilter> filters) {
		return provinceDao.findPage(page, filters);
	}	
	
	public void saveProvince(Province province) {
		provinceDao.save(province);
	}

	public void deleteProvince(Long id) {
		provinceDao.delete(id);
	}
}

